﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Qt
{
    /// <summary>
    /// Mapper接口
    /// </summary>
    public interface IMapper
    {
        /// <summary>
        /// 绑定关系
        /// </summary>
        /// <typeparam name="TDst"></typeparam>
        /// <typeparam name="TSrc"></typeparam>
        /// <param name="func">转换函数</param>
        void Bind<TDst, TSrc>(Func<TSrc, TDst> func);
        /// <summary>
        /// 根据源类型转换到目标类型(适用1对1绑定)，如果该类型绑定多个转换，则会出现异常
        /// </summary>
        /// <typeparam name="TSrc"></typeparam>
        /// <param name="src"></param>
        /// <returns></returns>
        dynamic Get<TSrc>(TSrc src);
        /// <summary>
        /// 根据源类型转换到目标类型(适用1对n绑定)
        /// </summary>
        /// <typeparam name="TDst"></typeparam>
        /// <typeparam name="TSrc"></typeparam>
        /// <param name="src"></param>
        /// <returns></returns>
        TDst Get<TDst, TSrc>(TSrc src);
    }
}
